package com.scqzy.shengchunqiang.sword2offer.day04;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description: 剑指 Offer 03. 数组中重复的数字
 * @Author 盛春强
 * @Date 2021/8/11 19:51
 */
public class FindRepeatNumber {
    public int findRepeatNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int num : nums) {
            if (!set.add(num)) {
                return num;
            }
        }
        return 0;
    }
}
